<%@ include file="/WEB-INF/jsp/includes/include.jsp" %>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<title>${entity.name}</title>
        <c:set var="messageboard"><spring:theme code="messageboard"/></c:set>
        <link rel="stylesheet" href="<c:url value="${messageboard}"/>" type="text/css" />
        <c:set var="profile"><spring:theme code="profile"/></c:set>
        <link rel="stylesheet" href="<c:url value="${profile}"/>" type="text/css" />
        <c:set var="userprofile"><spring:theme code="userprofile"/></c:set>
        <link rel="stylesheet" href="<c:url value="${userprofile}"/>" type="text/css" />
	</head>

	<body>

		<!-- BEGIN LEFT COLUMN -->
		<div id="leftcolumn">
	
			<!-- BEGIN USER PHOTO -->
			<div id="profilePhoto">
				<c:url scope="page" value="/getImage.do" var="entityImg">
					<c:param name="imgsrc" value="${entity.imgSrc}"/>
				</c:url>
				<a href="${entityImg}">
					<img src="${entityImg}" width="130" alt="${entity.name}" class="profilePhoto" />								
				</a>
				<div id="profileName">
					${entity.name}
				</div>
			</div>
			<!-- END USER PHOTO -->
	
			<!-- BEGIN LEFT NAV OPTIONS -->
			<div id="leftnavOptions">			
				<!-- show only if this is the profile of the current user -->
				<handsunited:relationship entity="${loggedInUser}" member="${entity}">
					<handsunited:role role="admin">				
						<div id="editProfile" class="leftnavLink">
							<c:url scope="page" value="/user/editprofile.html" var="editProfileURL">
								<c:param name="id" value="${entity.id}"/>
							</c:url>
							<a href="${editProfileURL}" class="leftnavButton">
								&raquo; Edit Profile
							</a>
						</div> <!-- #editProfile -->
					</handsunited:role>
				</handsunited:relationship>
			</div> <!-- #leftnavOptions -->
	
			<!-- END LEFT NAV OPTIONS -->
	
		</div> <!-- #leftcolumn -->
		<!-- END LEFT COLUMN -->
	
	
		<!-- BEGIN CENTRE COLUMN -->
		<div id="centercolumn">
		
			<div id="userName">
				<h1 id="userName" class="entityName">${entity.name}</h1>
			</div>

			<c:if test="${loggedInUser != null and loggedInUser.id == entity.id}">
				<jsp:include page="/WEB-INF/jsp/tiles/user/actionPendingRelationships.jsp"/>
				<jsp:include page="/WEB-INF/jsp/tiles/project/actionPendingRelationships.jsp"/>
				<jsp:include page="/WEB-INF/jsp/tiles/group/actionPendingRelationships.jsp"/>
				<jsp:include page="/WEB-INF/jsp/tiles/organisation/actionPendingRelationships.jsp"/>
			</c:if>
				
			<!-- BEGIN USER DETAILS -->
			<div id="userDetails">

				<h2 id="userDetailsTitle" class="sectionHeader">User details:</h2>

				<table id="userDetails" class="details">

					<colgroup>
						<col id="title" />
						<col id="content" />
					</colgroup>

					<tr class="row1">
						<td>Availability:</td>
						<td>
							<jsp:include page="/WEB-INF/jsp/tiles/availability.jsp"/>
						</td>
					</tr>
					<tr class="row2">
						<td>Work from:</td>
						<td>
							<c:if test="${entity.workFromHome}">
								<a href="#">Home</a>	
							</c:if>
							
							<c:if test="${entity.workFromHome && entity.workOnSite}">
							and
							</c:if>
							
							<c:if test="${entity.workOnSite}">
								<a href="#">On site</a>	
							</c:if>
						</td>
					</tr>
					<tr class="row1">
						<td>Known languages:</td>
						<td>
							<c:forEach items="${entity.languages}" var="language">
								<a href="#">${language.name}</a><br />
							</c:forEach>
						</td>
					</tr>
					<tr class="row2">
						<td>Skill set:</td>
						<td>
							<c:forEach items="${entity.skills}" var="skill">
								<a href="#">${skill.name}</a><br />
							</c:forEach>
						</td>
					</tr>
					
					<tr class="row1">
						<td>Interested service categories:</td>
						<td>
							<c:forEach items="${entity.serviceCategories}" var="serviceCategory">
								<a href="#">${serviceCategory.name}</a> <br />
							</c:forEach>
						</td>
					</tr>
				</table>
			</div> <!-- #userDetails -->
			<!-- END USER DETAILS -->


			<!-- BEGIN CONTACT INFO -->
			<div id="userContactInfo" class="contactInfo">

				<h2 id="userContactInfoTitle" class="sectionHeader">Contact info:</h2>

				<table id="userContactInfoTable">
					<colgroup>
						<col id="title" />
						<col id="content" />
					</colgroup>

					<tr class="row1">
						<td>Address:</td>
						<td>
							${entity.contactInfo.address.number} ${entity.contactInfo.address.street}<br/>
							${entity.contactInfo.address.suburb}<br/>
							${entity.contactInfo.address.city}<br/>
							${entity.contactInfo.address.state } ${entity.contactInfo.address.postcode}
						</td>
					</tr>
					<tr class="row2">
						<td>Phone numbers:</td>
						<td>
							Home: ${entity.contactInfo.homePhone} <br/>
							Work: ${entity.contactInfo.workPhone} <br/>
							Mobile: ${entity.contactInfo.mobilePhone}
						</td>
					</tr>
					<tr class="row1">
						<td>Fax:</td>
						<td>${entity.contactInfo.faxNumber}</td>
					</tr>
					<tr class="row2">
						<td>Email address:</td>
						<td>
							<a href="mailto:${entity.contactInfo.emailAddress}">
								${entity.contactInfo.emailAddress}
							</a>
						</td>
					</tr>
					<tr class="row1">
						<td>Website:</td>
						<td><a href="${entity.contactInfo.website}">${entity.contactInfo.website}</a></td>
					</tr>
				</table>
			</div> <!-- #userContactInfo -->
			<!-- END CONTACT INFO -->
			
			<!-- BEGIN MESSAGE BOARD -->
			<jsp:include page="/WEB-INF/jsp/tiles/messageBoard.jsp"/>
			<!-- END MESSAGE BOARD -->
		</div>
		<!-- END CENTRE COLUMN -->

		<!-- BEGIN RIGHT COLUMN -->
		<div id="rightcolumn">

			<!-- BEGIN USERS SECTION -->
			<jsp:include page="/WEB-INF/jsp/tiles/user/network.jsp"/>	
			<!-- END USERS SECTION -->

			<!-- BEGIN PROJECTS SECTION -->
			<jsp:include page="/WEB-INF/jsp/tiles/project/network.jsp"/>
			<!-- END PROJECTS SECTION -->

			<!-- BEGIN ORGANISATIONS SECTION -->
			<jsp:include page="/WEB-INF/jsp/tiles/organisation/network.jsp" />
			<!-- END ORGANISATIONS SECTION -->

		</div> <!-- #rightcolumn -->
		<!-- END RIGHT COLUMN -->
	</body>
</html>
